<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.tjtt.tdm.base.StringUtil"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String jiedian = request.getParameter("jiedian");
String weituoren = request.getParameter("weituoren");
if(!"".equals(weituoren)&&null!=weituoren&&!"null".equals(weituoren)){
   weituoren = StringUtil.encodingUrl(weituoren);
}
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <base target="_self"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	
    <script type="text/javascript">
    $(document).ready(function(){
            $("#entry").click(function(){
                    checking();
                   	if("<%=jiedian%>" == "1"){
                    	var re_shenheren = $("#re_shenheren").val();
				 		var re_pizhunren = $("#re_pizhunren").val();
				        window.returnValue = '{"re_shenheren":"'+re_shenheren+'","re_pizhunren":"'+re_pizhunren+'","state":"save"}';
                   	}else if("<%=jiedian%>" == "4"){
                   		var re_bxshenheren = $("#re_bxshenheren").val();
				 		var re_bxpizhunren = $("#re_bxpizhunren").val();
				 		var re_diaoduyuan = $("#re_diaoduyuan").val();
				        window.returnValue = '{"re_bxshenheren":"'+re_bxshenheren+'","re_bxpizhunren":"'+re_bxpizhunren+'","re_diaoduyuan":"'+re_diaoduyuan+'","state":"save"}';
                   	}
                   	else if("<%=jiedian%>" == "7"){
                   		var re_fafangren = $("#re_fafangren").val();
				        window.returnValue = '{"re_fafangren":"'+re_fafangren+'","state":"save"}';
                   	}
				       
			        window.close();
	         });
	  		 $("#center").click(function(){
	  		 		window.returnValue = '{"state":"close"}';
			        window.close();
	         });
	});
	
   	function checking(){
			var re_shenherenname = $.trim($("#re_shenherenname").val());
			var re_pizhunrenname = $.trim($("#re_pizhunrenname").val());
			if("<%=jiedian%>" == "1"){
			if(re_shenherenname ==null || re_shenherenname == "" ){
				alert("审核人不能为空！");
				$("#re_shenherenname").focus();
	    		return false;
			}
			if(re_pizhunrenname ==null || re_pizhunrenname == "" ){
				alert("批准人不能为空！");
				$("#re_pizhunrenname").focus();
	    		return false;
			}
		}else if("<%=jiedian%>" == "4"){
			var re_bxshenherenname = $.trim($("#re_bxshenherenname").val());
			var re_bxpizhunrenname = $.trim($("#re_bxpizhunrenname").val());
			var re_diaoduyuanname = $.trim($("#re_diaoduyuanname").val());
			if(re_bxshenherenname ==null || re_bxshenherenname == "" ){
				alert("审核人不能为空！");
				$("#re_bxshenherenname").focus();
	    		return false;
			}
			if(re_bxpizhunrenname ==null || re_bxpizhunrenname == "" ){
				alert("批准人不能为空！");
				$("#re_bxpizhunrenname").focus();
	    		return false;
			}
			if(re_diaoduyuanname ==null || re_diaoduyuanname == "" ){
				alert("调度员不能为空！");
				$("#re_diaoduyuanname").focus();
	    		return false;
			}
		}
		else if("<%=jiedian%>" == "7"){
			var re_fafangrenname = $.trim($("#re_fafangrenname").val());
			if(re_fafangrenname ==null || re_fafangrenname == "" ){
				alert("委托人不能为空！");
				$("#re_fafangrenname").focus();
	    		return false;
			}
		}
	}

	
	//选择人员
	function selectperson(id)
	{
		 var users = window.showModalDialog("<%=request.getContextPath() %>/resource/choose/selectUserByRole.jsp?roleid=", window, "dialogWidth:900px;status:no;dialogHeight:500px");
    	if (users != null) {
			$("#"+id+"name").val(users.username);
		    $("#"+id).val(users.userid);
		   }
	}
	

   </script>
 	<style type="text/css">
 		body{
 			background:#ffffff; background-image:url(images/);
 		}
   		html{
		    overflow-x: hidden;
			overflow-y: hidden;
		}  	
		.formTableNew textarea{border: 1px solid #999;padding: 5px;width: 760px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
   </style>
  </head>
  
  <body>
<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
        <!-- 发起节点选择人员 -->
        <%if("1".equals(jiedian)){ %>
        <table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <td align="right">审核人：</td>
  			  <td align="left">
  			    <input type="hidden" id="re_shenheren" name="re_shenheren" value="" />
  			    <input  type="text"  id="re_shenherenname" maxlength="50" name="re_shenherenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('re_shenheren')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">批准人：</td>
  			  <td align="left">
  			    <input type="hidden" id="re_pizhunren" name="re_pizhunren" value="" />
  			    <input  type="text"  id="re_pizhunrenname" maxlength="50" name="re_pizhunrenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('re_pizhunren')" />
  			  </td>
  			</tr>
		</table>
		<%}else if("4".equals(jiedian)){%>
        <table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <td align="right">审核人：</td>
  			  <td align="left">
  			    <input type="hidden" id="re_bxshenheren" name="re_bxshenheren" value="" />
  			    <input  type="text"  id="re_bxshenherenname" maxlength="50" name="re_bxshenherenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('re_bxshenheren')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">批准人：</td>
  			  <td align="left">
  			    <input type="hidden" id="re_bxpizhunren" name="re_bxpizhunren" value="" />
  			    <input  type="text"  id="re_bxpizhunrenname" maxlength="50" name="re_bxpizhunrenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('re_bxpizhunren')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">调度员：</td>
  			  <td align="left">
  			    <input type="hidden" id="re_diaoduyuan" name="re_diaoduyuan" value="" />
  			    <input  type="text"  id="re_diaoduyuanname" maxlength="50" name="re_diaoduyuanname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('re_diaoduyuan')" />
  			  </td>
  			</tr>
		</table>
        <%}else if("7".equals(jiedian)){%>
           <tr>
  			  <td align="right">委托人：</td>
  			  <td align="left">
  			    <input type="hidden" id="re_fafangren" name="re_fafangren" value="" />
  			    <input  type="text"  id="re_fafangrenname" maxlength="50" name="re_fafangrenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="<%=weituoren%>" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('re_fafangren')" />
  			  </td>
  		   </tr>
        <%} %>
  		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>
			<td align="center">
		    	<input id="entry" type="button" value="提 交" class="form_bt_orange" />
		    	<input type="button" id="center" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
